<template>
  <div class="taskfrom" style="padding: 5px 20px">
    <el-form label-position="left">
      <!-- 基础信息分栏 -->
      <el-row :gutter="20">
        <!-- 任务内容 -->
        <el-col :span="24">
          <el-form-item label-width="120px" required>
            <span slot="label">
                <span class="span-box">
                  <i class="iconfont icon-renwu"></i>
                  <span class="itemtle">任务内容</span>
                </span>
            </span>
            <el-input style="width: 85%" v-model="basicInfo.title" ref="taskName" 
                      @input="ischange(basicInfo.title,'taskName')"
                      v-show="ismodify" size="mini">
            </el-input>
            <p v-show="!ismodify" style="font-size: 20px; font-weight: 600">{{ basicInfo.title }}</p>
          </el-form-item>
        </el-col>
          <!-- 任务要求 -->
        <el-col :span="24">
          <el-form-item label-width="120px">
            <span slot="label">
              <span class="span-box" style="margin-left:9px">
                <i class="iconfont icon-renwumiaoshu"></i>
                <span class="itemtle">任务要求</span>
              </span>
            </span>
              <el-input
              ref="taskmsg" 
              v-show="ismodify"
              style="width: 85%"
              @input="ischange(basicInfo.richContent,'taskmsg')"
              type="textarea"
              :autosize="{ minRows: 2, maxRows: 4}"
              placeholder="请输入任务要求"
              v-model="basicInfo.richContent">
          </el-input>
          <p v-show="!ismodify"
             style="white-space: normal;text-indent: 2.2em;word-wrap:break-word;word-break:normal; word-break: break-all;">
            {{ basicInfo.richContent }}</p>
          </el-form-item>
        </el-col>
        <!-- 负责人 -->
        <el-col :span="8">
          <el-form-item label-width="120px" required>
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-zerenren"></i>
                <span class="itemtle">负责人</span>
              </span>
            </span>
            <!--<el-input style="width:10%" v-model="basicInfo.manager"></el-input>-->
            <span class="managerInfo">{{ basicInfo.manager }} </span>
            <span v-if="publisher">
              <i v-if="!basicInfo.viewed" class="iconfont icon-bukejian1" style="font-size: 20px;color: #7B7B7B"></i>
              <i v-else class="iconfont icon-iconfontbukejian" style="font-size: 20px;color: #7B7B7B"></i>
            </span>
            <el-button size="mini" style="margin-left: 20px" @click="selectPeople('manager')" v-if="ismodify">选人</el-button>
            <el-button v-if="!ismodify && basicInfo.approveState != '草稿' && basicInfo.approveState != '已关闭'" icon="el-icon-bell" @click="cb" type="primary" size="mini">催办</el-button>
            <span style="margin-left:5px;padding:1px 2px;background-color:#bdb5b5" v-show="basicInfo.taskSubmissionStatus == '已接收'">{{basicInfo.taskSubmissionStatus}}</span>
          </el-form-item>
        </el-col>

        <!-- 负责部门 -->
        <el-col :span="8">
          <el-form-item label-width="120px" required>
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-kesuzerenbumenweihu"></i>
                <span class="itemtle">负责部门</span>
              </span>
            </span>
            <span class="managerInfo">{{ basicInfo.managerDepartment }}</span>
            <el-button size="mini" style="margin-left: 20px" @click="selectPeoples()" v-if="ismodify">选择部门</el-button>
          </el-form-item>
        </el-col>

        <!-- 任务关注 -->
        <el-col :span="8">
          <el-form-item label-width="120px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-kesuzerenbumenweihu"></i>
                <span class="itemtle">任务关注</span>
              </span>
            </span>
            <span class="managerInfo">{{ extInfo.taskCaseName }}</span>
            <el-button size="mini" style="margin-left: 20px" @click="selectPeople1()" v-if="ismodify">选人</el-button>
          </el-form-item>
        </el-col>

       
        <!-- 提前预警天数 -->
                <el-col :span="7" style="float:right" v-if="isType == false">
                  <el-form-item label-width="130px" style="margin-left: 8px;">
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-yujingjinggao isbt"></i>
                        <span class="itemtle">提前预警天数</span>
                      </span>
                    </span>
                    <!-- <el-input style="width: 60%" v-model="basicInfo.warnDay"></el-input>-->
                    <el-input-number v-model="basicInfo.warnDay" :min="0" label="预警天数" size="mini" v-show="ismodify"></el-input-number>
                    <p v-show="!ismodify">{{ basicInfo.warnDay }}</p>
                  </el-form-item>
                </el-col>
        <!-- 提醒周期 -->
          <el-col span="7" style="float:right">
          <el-form-item label-width="120px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-yujingjinggao"></i>
                <span class="itemtle">提醒周期(天)</span>
              </span>
            </span>
            <!--                    <el-input style="width: 60%" v-model="extInfo.reportCycle"></el-input>-->
            <el-input-number
              v-model="extInfo.reportCycle"
              :min="0"
              :step="1"
              :max="7"
              size="mini"
              v-if="ismodify"
            ></el-input-number>
              <p v-else>{{ extInfo.reportCycle }}</p>
          </el-form-item>
        </el-col>
        <!-- 计划时间 -->
        <el-col span="10" style="float:left" v-if="isType == false">
          <el-form-item label-width="120px" required style="margin-left:0px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-jihuashijian"></i>
                <span class="itemtle">计划时间</span>
              </span>
            </span>
            <div class="vct">
              <el-date-picker
              style="width: 100%"
                v-model="basicInfo.time"
                :clearable=false
                value-format="yyyy-MM-dd"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                size="mini"
                ref="timese"
                @change="ischange(basicInfo.time,'timese')"
                v-show=" ismodify"
                :disabled="basicInfo.cycle"
              ></el-date-picker>
              <!-- <span style="color: red;margin-left: 10px" v-show="ismodify">周期性任务无需填写此信息</span> -->
              <p v-show="!ismodify">{{ basicInfo.time[0] + ' 至 ' + basicInfo.time[1] }}</p>
            </div>
          </el-form-item>
        </el-col>

        <!-- 任务附件 -->
        <el-col :span="24">
          <el-form-item label-width="120px">
            <span slot="label">
              <span class="span-box" style="margin-left:9px">
                <i class="iconfont icon-fujian1"></i>
                <span class="itemtle">任务附件</span>
              </span>
            </span>
            <el-upload
              :disabled="!ismodify"
              class="upload-demo"
              multiple
              action="/seeyon/rest/attachment?applicationCategory=0&extensions=&firstSave=true?option.n_a_s=1"
              :on-change="handleChange"
              :on-success="handleAvatarSuccess"
              :on-preview="showfile"
              ref="upload"
              :before-remove="beforeremove"
              :on-remove="Remove"
              :file-list="extInfo.fileList"
            >
              <el-button size="small" type="primary" :disabled="!ismodify"
                >点击上传</el-button
              >
            </el-upload>
          </el-form-item>
        </el-col>
        <!-- 任务状态 -->
        <el-col :span="12" v-show="!create">
          <el-form-item label-width="120px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-tasktype isbt"></i>
                <span class="itemtle">任务状态</span>
              </span>
            </span>
            <el-tag :color="handleSubTaskStatusColor(basicInfo.state)" style="color: white;border: none">
              {{ basicInfo.state }}
            </el-tag>
          </el-form-item>
        </el-col>
        <!-- 添加子任务 -->
        <!-- <el-col :span="12" v-show="!create">
            <div class="add-template" style="margin-top: 14px;">
                  <el-button
                    v-if="isBtnAuth"
                    type="primary"
                    size="mini"
                    @click="emitCustomEvent"
                    >添加子任务
                  </el-button>
                  <span style="color: red" v-else-if="completed"
                    >当前任务已完成，无法添加子任务</span
                  >
                  <span style="color: red" v-else
                    >任务未保存或没有新建子任务权限</span
                  >
                </div>
        </el-col> -->

        <!-- 审批状态 -->
        <!-- <el-col :span="12" v-show="!create">
          <el-form-item label-width="120px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-tasktype isbt"></i>
                <span class="itemtle">审批状态</span>
              </span>
            </span>
            <el-tag :type="appStateTypeMethod(basicInfo.approveState)">{{ basicInfo.approveState }}</el-tag>
          </el-form-item>
        </el-col> -->

        <!-- 父任务时间 -->
        <el-col :span="24">
          <el-form-item label-width="200px" v-if="basicInfo.taskLevel != 1">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-jihuashijian"></i>
                <span class="itemtle">父级计划时间-结束时间</span>
              </span>
            </span>
            <div class="vct">
              <p>{{ basicInfo.parentStart + ' 至 ' + basicInfo.parentEnd }}</p>
            </div>
          </el-form-item>
        </el-col>

        <!-- 是否自动完结 -->
        <el-col :span="12" v-if="false">
          <el-form-item label-width="140px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-zidongwancheng1 isbt"></i>
                <span class="itemtle">是否自动完结</span>
              </span>
            </span>
            <el-checkbox v-model="basicInfo.autoComplete" :disabled="!ismodify"></el-checkbox>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 周期任务分栏 -->
      <el-row :gutter="20">
        <!-- 是否周期任务 -->
        <!-- <el-col :span="12">
          <el-form-item label-width="140px">
            <span slot="label">
              <span class="span-box">
                <i class="iconfont icon-zhouqirenwu isbt"></i>
                <span class="itemtle">是否周期性任务</span>
              </span>
            </span>
            <el-popover
              placement="right-start"
              width="500"
              trigger="hover"
              content="当前任务是周期任务触发的任务，无法再被设置为周期任务，如需修改周期任务，请修改第一个周期任务或者新建一个任务！"
              :disabled="!(ismodify&&(basicInfo.canBeCycleSource == false))"
            >
              <el-switch
                slot="reference"
                :disabled="!(ismodify&&basicInfo.canBeCycleSource)"
                v-model="basicInfo.cycle"
                active-color="#13ce66"
                inactive-color="#ff4949"
                @change="isshow"
              ></el-switch>
            </el-popover>
          </el-form-item>
        </el-col> -->
         
        <!-- 周期任务详细栏 -->
        <el-col :span="24" v-if="isType">
          <el-collapse v-model="activeNames" >
            <el-collapse-item name="1" class="zhouqi">
              <template slot="title">
                <i class="iconfont icon-zhouqixingrenwu" style="color: #42b983;font-size: 28px"></i>
                <p style="font-size: 16px;margin-left: 5px;font-weight: bolder;">周期性任务</p>
              </template>
              <el-row>
                <!-- 任务时长 -->
                <el-col :span="9">
                  <el-form-item label-width="190px">
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-zhongfu isbt" style="color: red"></i>
                        <span class="itemtle" style="color: red">任务时长（天）</span>
                      </span>
                    </span>
                    <el-input-number style="width: 60%" v-model="basicInfo.period"
                              :disabled="!ismodify" size="mini" :min="1">
                    </el-input-number>
                  </el-form-item>
                </el-col>
                  <!-- 是否间隔执行 -->
                  <el-col :span="6">
                    <el-form-item style="margin-left: 8px;">
                      <span slot="label">
                        <span class="span-box">
                          <i class="iconfont icon-zhongfu isbt"></i>
                          <span class="itemtle">是否间隔执行</span>
                        </span>
                      </span>
                      <el-checkbox v-model="basicInfo.intervalTask" :disabled="!ismodify"></el-checkbox>
                    </el-form-item>
                  </el-col>
                <!-- 重复间隔 -->
                <el-col :span="9" v-if="basicInfo.intervalTask">
                  <el-form-item label-width="190px">
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-zhongfu isbtt"></i>
                        <span class="itemtle">任务重复间隔(天)</span>
                      </span>
                    </span>
                    <el-input-number style="width: 60%" 
                                     v-model="basicInfo.cycleInterval"
                                     :min="0" label="重复间隔"
                                     size="mini" v-show="ismodify">
                    </el-input-number>
                    <p v-show="!ismodify">{{ basicInfo.cycleInterval }}</p>
                  </el-form-item>
                </el-col>
                <!-- 周期任务类型 -->
                <el-col :span="9" v-else>
                  <el-form-item label-width="160px">
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-zhongfu isbtt"></i>
                        <span class="itemtle">周期性任务类型</span>
                      </span>
                    </span>
                    <!-- <el-select v-model="basicInfo.cycleType" placeholder="请选择" 
                               :disabled="!basicInfo.cycle" 
                               size="mini"
                               style="width: 60%"
                               v-show="ismodify">
                      <el-option
                          v-for="item in basicInfo.cycleTypeEnums"
                          :key="item.code"
                          :label="item.disPlay"
                          :value="item.code">
                      </el-option>
                    </el-select> -->
                      <el-select v-model="basicInfo.cycleType" placeholder="请选择" 
                               size="mini"
                               style="width:100%"
                               v-show="ismodify">
                      <el-option
                          v-for="item in basicInfo.cycleTypeEnums"
                          :key="item.code"
                          :label="item.disPlay"
                          :value="item.code">
                      </el-option>
                    </el-select>
                    <p v-show="!ismodify">{{ basicInfo.cycleTypeStr }}</p>
                  </el-form-item>
                </el-col>
                <!-- 周期任务开始时间 -->
                <el-col :span="12">
                  <el-form-item label-width="190px" required>
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-zhongfu"></i>
                        <span class="itemtle">周期任务开始时间</span>
                      </span>
                    </span>
                    <div class="timebox">
                      <el-date-picker
                          v-show="ismodify"
                          v-model="basicInfo.cycleStart"
                          type="datetime"
                          size="mini"
                          value-format="yyyy-MM-dd HH:mm"
                          placeholder="选择日期时间"
                          style="width:100%">
                      </el-date-picker>
                      <p v-show="!ismodify">{{ basicInfo.cycleStart }}</p>
                    </div>
                  </el-form-item>
                </el-col>
                <!-- 周期任务结束时间 -->
                <el-col :span="12">
                  <el-form-item label-width="190px">
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-zhongfu isbtt"></i>
                        <span class="itemtle">周期任务结束时间</span>
                      </span>
                    </span>
                    <div class="timebox">
                      <el-date-picker
                          size="mini"
                          v-show="ismodify"
                          v-model="basicInfo.cycleEnd"
                          type="datetime"
                          value-format="yyyy-MM-dd HH:mm"
                          placeholder="选择日期时间"
                          style="width: 100%">
                      </el-date-picker>
                      <p v-show="!ismodify">{{ basicInfo.cycleEnd }}</p>
                    </div>
                  </el-form-item>
                </el-col>
                 <!-- 提前预警天数 -->
                <el-col :span="8">
                  <el-form-item label-width="130px" style="margin-left: 8px;">
                    <span slot="label">
                      <span class="span-box">
                        <i class="iconfont icon-yujingjinggao isbt"></i>
                        <span class="itemtle">提前预警天数</span>
                      </span>
                    </span>
                    <!-- <el-input style="width: 60%" v-model="basicInfo.warnDay"></el-input>-->
                    <el-input-number v-model="basicInfo.warnDay" :min="0" label="预警天数" size="mini" v-show="ismodify"></el-input-number>
                    <p v-show="!ismodify">{{ basicInfo.warnDay }}</p>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-collapse-item>
          </el-collapse>
        </el-col>
      </el-row>

    </el-form>
  </div>
</template>

<script>
let id = 0;
export default {
  name: 'taskmsg',
  props: {
    extInfo: {},
    basicInfo: {},
    ismodify: '',
    publisher: '',
    create: '',
    // completed: '',
    // isBtnAuth:''
  },
  data() {
    return {
      // 任务类型
      isType:false,
      activeNames:'',
      bt: ['taskName', 'timese', 'taskmsg'],
      options: [],
      props: {
        emitPath: true,
        checkStrictly: true,
        multiple: true
        // checkStrictly: true,
        // lazy: true,
        // lazyLoad: this.lazyLoad
      }
    };
  },
  mounted() {
    this.isshow();
    this.getlistss();
    if(top.location.href.split("isType=")[1]=='dinqi'){
      this.isType = true
    }
    console.log('isType',this.isType)
    console.log('基本信息页basicInfo',this.basicInfo)
    console.log('基本信息页extInfo',this.extInfo)
  },
  beforeMount() {

  },
  beforeUpdate() {

  },
  updated() {

  },
  watch: {
    basicInfo: {
      handler(newVal, oldVal) {
        if (this.ismodify == true) {
          this.bt.forEach(m => {
            if (this.time) {
              if (this.basicInfo.time) {
                this.$refs[m].$el.children[1].style.background = 'white';
                this.$refs[m].$el.children[3].style.background = 'white';
              } else {
                this.$refs[m].$el.children[1].style.background = '#feefcf';
                this.$refs[m].$el.children[3].style.background = '#feefcf';
              }
            } else {
              // if (this.basicInfo.richContent) {
              //   this.$refs['taskmsg'].$el.children[0].style.background = 'white';
              // } else {
              //   this.$refs['taskmsg'].$el.children[0].style.background = '#feefcf';
              // }
              if (this.basicInfo.title) {
                this.$refs['taskName'].$el.children[0].style.background = 'white';
              } else {
                this.$refs['taskName'].$el.children[0].style.background = '#feefcf';
              }
              if(this.basicInfo.time[0]!==''){
                this.$refs['timese'].$el.children[1].style.background = 'white';
                this.$refs['timese'].$el.children[3].style.background = 'white';
              }
              else{
                this.$refs['timese'].$el.children[1].style.background = '#feefcf';
                this.$refs['timese'].$el.children[3].style.background = '#feefcf';
              }
            }
          });
        }
        this.isshow();
      },
      deep: true
    },
  },
  methods: {
    getlistss() {
      this.$http.query(`/seeyon/rest/bhtTaskIndex/enum/tag`).then((res) => {
        let {code, data} = res;
        if (code == 0) {
          // node = res.data.map(item => {
          //     return {
          //         value: item.value,
          //         label: item.label,
          //         leaf:node.level >= item.children.length
          //     }})
          this.options = res.data;
          this.options.forEach(d => {
            if (d.children.length == 0) {
              d.children = null;
            }

          });
        }
      });
    },
    // 点击后触发父组件添加子任务方法
    // emitCustomEvent() {
    //   // 触发自定义事件，并传递一些数据给父组件
    //   this.$emit('custom-event');
    // },
    // lazyLoad(node, resolve){
    //     this.$http.query(`/seeyon/rest/bhtTaskIndex/enum/tag`).then((res) => {
    //         let {code, data} = res;
    //         if (code == 0) {
    //             console.log(res)
    //             // node = res.data.map(item => {
    //             //     return {
    //             //         value: item.value,
    //             //         label: item.label,
    //             //         leaf:node.level >= item.children.length
    //             //     }})
    //             resolve(node)
    //         }
    //     });
    // },

    appStateTypeMethod(appState) {
      //正常、完成待审、正常完成、超期完成、被驳回、已关闭
      let type = 'success';
      switch (appState) {
        case '正常':
        case '正常完成':
          type = 'success';
          break;
        case '超期完成':
          type = 'danger';
          break;
        case '被驳回':
        case '完成待审':
          type = 'warning';
          break;
        case '已关闭':
          type = 'info';
          break;
        default:
          type = '';
          break;
      }
      return type;
    },
    getcolor(appState) {
      let type = 'success';
      switch (appState) {
        case '人事':
          type = 'success';
          break;
        case '财务':
          type = 'danger';
          break;
        case '采购':

          type = 'warning';
          break;
        case '日常':
          type = 'info';
          break;
        case '其它':
          type = '';
          break;
        default:
          type = '';
          break;
      }
      return type;
    },
    handleSubTaskStatusColor(state) {
      let color = '';
      switch (state) {
        case '进行中':
          color = '#40E0D0';
          break;
        case '已完成':
          color = '#00FA9A';
          break;
        case '已超期':
          color = '#FF0000';
          break;
        case '已删除':
          color = '#000';
          break;
        case '未开始':
          color = '#BEBEBE';
          break;
        case '预警中':
          color = '#EEAD0E';
          break;
        default:
          color = '#000';
          break;
      }
      return color;
    },
    increase() {
      if (this.basicInfo.weightStyle == true) {
        this.$message({
          type: 'info',
          message: '如需手动修改进度,请先解锁自动计算!'
        });
        return false;
      }
      if (this.basicInfo.processRateNum < 100) {
        this.basicInfo.processRateNum += 5;
        if (this.basicInfo.processRateNum > 100) {
          this.basicInfo.processRateNum = 100;
        }
      }
    },
    decrease() {
      if (this.basicInfo.weightStyle == true) {
        this.$message({
          type: 'info',
          message: '如需手动修改进度,请先解锁自动计算!'
        });
        return false;
      }
      if (this.basicInfo.processRateNum > 0) {
        this.basicInfo.processRateNum -= 5;
        if (this.basicInfo.processRateNum < 0) {
          this.basicInfo.processRateNum = 0;
        }
      }
    },
    isshow() {
      this.activeNames = ['1'];
    },
    showfile(file) {
      if (file.response) {
        file = file.response.atts[0];
      }
      if (file.mimeType.slice(0, 5) == "image") {
        this.imgPath = "#";
        this.imgPath = `/seeyon/fileUpload.do?method=showRTE&fileId=${encodeURI(
          file.fileUrl
        )}&type=image&showType=big`;
        this.imgfile = file;
        this.dialogVisible = true;
      } else if (file.mimeType == "application/pdf") {
        window.open(
          encodeURI(
            `/seeyon/fileDownload.do?method=doDownload4Office&type=Pdf&isOpenFile=true&fileId=${encodeURI(
              file.fileUrl
            )}&createDate=${file.createdate.slice(0, 10)}&filename=${encodeURI(
              file.filename
            )}`
          )
        );
      } else {
        window.location.href = encodeURI(
          `/seeyon/rest/attachment/file/${encodeURI(
            file.fileUrl
          )}?fileName=${encodeURI(file.filename)}`
        );
      }
    },
    handleChange(file, fileList) {
      // this.extInfo.fileList = fileList.slice(-3);
    },
    handleAvatarSuccess(res, file, fileList) {
      let arr = [];
      arr.push(res.atts[0].fileUrl);
      this.extInfo.fieldIds = arr.toString();
      let obj = {
        fileIds: this.extInfo.fieldIds,
      };
      this.$http
        .post(
          `/seeyon/rest/taskDetail/attachments/upload/${this.basicInfo.taskId}/${this.extInfo.subReference}`,
          obj
        )
        .then((res) => {
          let { code, data } = res;
          if (code == 0) {
          } else {
          }
        });
    },
    beforeremove(file) {
      return this.$confirm(`确定移除该文件 ${file.name}？`);
    },
    Remove(file, fileList) {
      let _this = this;
      // if (file.response){
      //     file = file.response.atts[0]
      // }
      // _this.$message({
      //     type: 'success',
      //     message: '删除成功!'
      // });
      this.$http
        .query(`/seeyon/rest/taskDetail/attachments/delete/${file.id}`)
        .then((res) => {
          let { code, data } = res;
          if (code == 0) {
            if (file.response) {
              file = file.response.atts[0];
            }
            _this.$message({
              type: "success",
              message: "删除成功!",
            });
          } else {
            this.$message({
              type: "info",
              message: "删除失败!",
            });
          }
        });
    },
    //选发起人
    selectPeopless() {
      let _this = this;
      let strId = `Member|${this.basicInfo.publishId}`;
      let name = this.basicInfo.publisher;
      parent.$.selectPeople({
        // 授权时的组织机构面板内容
        type: 'selectPeople',
        panels: 'Department,Team,Post,Outworker,RelatePeople',
        selectType: 'Member',
        onlyLoginAccount: true,
        isNeedCheckLevelScope: false,//不受职务级别控制
        minSize: 1,//只能选择1个人
        maxSize: 1,//
        excludeElements: strId,
        params: {
          text: _this.basicInfo.publisher,
          value: strId
        },

        fillBackData: {},
        callback(result) {
          //const progressBar = ctpTop. parent.$progressBar({ text: `` });
          //_this.$emit('changeAuth', list, result, progressBar);
          _this.$set(_this.basicInfo, 'publisher', result.text);
          _this.$set(_this.basicInfo, 'publishId', result.value.slice(7));

        }
      });
    },
    cb() {
      this.$http.query(`/seeyon/rest/bhtTask/remind/${this.basicInfo.taskId}`).then((res) => {
        let {code, data} = res;
        if (code == 0) {
          this.$message.success(res.data);
        } else {
          this.$message.warning(res.message);
        }
      });
    },
    selectPeople(it) {
      let strId = `Member|${this.basicInfo.managerId}`;
      let _this = this;
      parent.$.selectPeople({
        // 授权时的组织机构面板内容
        type: 'selectPeople',
        panels: 'Department,Team,Post,Outworker,RelatePeople',
        selectType: 'Member',
        onlyLoginAccount: true,
        isNeedCheckLevelScope: false,//不受职务级别控制
        minSize: 1,//只能选择1个人
        maxSize: 1,//
        excludeElements: strId,
        params: {
          text: _this.basicInfo.manager,
          value: strId
        },
        fillBackData: {},
        callback(result) {
        console.log('result',result)
          //const progressBar = ctpTop. parent.$progressBar({ text: `` });
          //_this.$emit('changeAuth', list, result, progressBar);
          _this.$set(_this.basicInfo, it, result.text);
          _this.$set(_this.basicInfo, `${it}Id`, result.value.slice(7));
          // 选择负责人后自动填充部门
          _this.$set(_this.basicInfo, 'managerDepartment', result.obj[0].deptName);
          _this.$set(_this.basicInfo, 'managerDepartmentId', result.obj[0].departmentId);

        }
      });
    },
    ischange(e, m) {
      // if (m == 'timese') {
      //   if (e == '' || e == null) {
      //     this.$refs[m].$el.children[1].style.background = '#feefcf';
      //     this.$refs[m].$el.children[3].style.background = '#feefcf';
      //   } else {
      //     this.$refs[m].$el.children[1].style.background = 'white';
      //     this.$refs[m].$el.children[3].style.background = 'white';
      //     this.basicInfo.issavetask = true;
      //   }
      // } else {
      //   if (e == '' || e == null) {
      //     this.$refs[m].$el.children[0].style.background = '#feefcf';
      //   } else {
      //     this.$refs[m].$el.children[0].style.background = 'white';

      //   }
      // }
      this.basicInfo.issavetask = true;
    },

    selectPeoples() {
      let strId = `Department|${this.basicInfo.managerDepartmentId}`;
      let _this = this;
      parent.$.selectPeople({
        // 授权时的组织机构面板内容
        type: 'Department',
        panels: 'Department,Team,Post,Outworker,RelatePeople',
        selectType: 'Department,Team',
        onlyLoginAccount: true,
        isNeedCheckLevelScope: false,//不受职务级别控制
        minSize: 1,//只能选择1个人
        maxSize: 1,//
        params: {
          text: _this.basicInfo.managerDepartment,
          value: strId
        },

        fillBackData: {},
        callback(result) {
          console.log('result',result);
          //const progressBar = ctpTop. parent.$progressBar({ text: `` });
          //_this.$emit('changeAuth', list, result, progressBar);
          console.log('负责部门', result);
          _this.$set(_this.basicInfo, 'managerDepartment', result.text);
          _this.$set(_this.basicInfo, 'managerDepartmentId', result.value.slice(11));
        }
      });
    },
    selectPeople1() {
      let _this = this;
      let str = "";
      if (this.extInfo.taskCaseIds != null) {
        let joinArr = this.extInfo.taskCaseIds.split(",");
        joinArr.forEach((join) => {
          str += "Member|" + join + ",";
        });
        str = str.substring(0, str.length - 1);
      }
      parent.$.selectPeople({
        // 授权时的组织机构面板内容
        type: "selectPeople",
        panels: "Department,Team,Post,Outworker,RelatePeople",
        selectType: "Member",
        onlyLoginAccount: true,
        isNeedCheckLevelScope: false, //不受职务级别控制
        // excludeElements:str,
        params: {
          text: _this.extInfo.taskCaseIds,
          value: str,
        },
        fillBackData: {},
        callback(result) {
          //const progressBar = ctpTop.$.progressBar({ text: `` });
          //_this.$emit('changeAuth', list, result, progressBar);
          let arr = [];
          result.obj.forEach((d) => {
            arr.push(d.id);
          });
          _this.$set(_this.extInfo, "taskCaseName", result.text);
          _this.$set(_this.extInfo, "taskCaseIds", arr.toString());
        },
      });
    },
  }
};
</script>

<style scoped>
@import '../../assets/icon.css';
.zhouqi>div{
  padding: 0px !important;
}

.iconfont {
  color: #409EFF;
  font-size: 16px;
  margin-right: 10px;
}

/*.timebox /deep/ .el-input__inner {*/
/*    padding-left: 30px !important;*/
/*    padding-right: 30px !important;*/
/*}*/

.isbt {
  margin-left: 8px;
}

.isbtt {
  margin-left: 16px;
}
.managerInfo{
    float: left;
    max-width: 100px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

</style>
